#ifndef __MYMATH_H_
#define __MYMATH_H_

#include "board.h"

#define M_MAX(a, b) ((a) > (b) ? (a) : (b))
#define M_MIN(a, b) ((a) < (b) ? (a) : (b))
#define M_ABS(a) ((a) >= 0 ? (a) : (-(a)))
#define LIMIT_P(a, max) (a > max ? max : (a <= 0 ? 0 : a))
#define LIMIT_PM(a, max) (a > max ? max : (a < -max ? -max : a))
#define LIMIT_BP(a, max, min) (a > max ? max : (a < min ? min : a))

fp32 MidAvg_Filter(fp32 *buf, uint8 num);

#endif // !__MYMATH_H_